<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>

<script type="text/javascript" src="js/jquery-easyui-1.5.4.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5.4.2/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5.4.2/themes/black/easyui.css" />

<script type="text/javascript" src="js/datagrid-cellediting.js"></script>
<script type="text/javascript" src="js/common.js"></script>      
  
  
      
</head>
<body>
<link rel="stylesheet" type="text/css" href="css/llj/CustomerCare_css.css">       
<script type="text/javascript">

	function editOrder(coId){
		$("#CustormerAddLog").dialog({href2:"editCustomerCanoneata",title:"编辑客户关怀主题"});       
		$("#C_Care_form_data").form('load','getCustorByid?ccId='+coId);      
		$("#CustormerAddLog").dialog("open");                      	   
	}  
	$(function(){ 
		$('#CustormerAdd').linkbutton({onClick:function() {         
			$("#CustormerAddLog").dialog({href2:"addCustomerCanoneata",title:"新建客户关怀主题"});   
			$("#C_Care_form_data").form("clear");  
			$("#C_care_inputccId").val(100);//根据id赋值      
			$("#CustormerAddLog").dialog("open");      
		}    
	    });     
	})
	$(function() {
		$("#llj-add-ok").linkbutton({onClick:function(){  
			//alert($('#CustormerAddLog').dialog('options').href2);   
			$("#C_Care_form_data").form({  
				url: $('#CustormerAddLog').dialog('options').href2,
				method:"post",        
				onSubmit:function(params){  
					return $(this).form('validate');   
				},  
				success:function(v){
					var data='"success"';   
					if(v==data){  
						alert("操作成功"); 
					}else{
						alert("操作失败");  
					}
					$("#CustormerAddLog").window("close");  
					$('#CustomerDgrid').datagrid('reload');     
				}
			}).submit();
		}});	
	})
	function deleteOrder(coId){
		$.messager.confirm('提示','确定要删除吗？',function(v){
			if(v){
				$.getJSON('delete_CustomerCare',{CC_id:coId},function(obj){
					if(obj=='"success"'){   
						alert("删除成功");
					}else{    
						alert("删除成功");   
					}  
					$('#CustomerDgrid').datagrid('reload');   
				});
			}
		});
	}
	$(function(){
		$("#llj_refresh_list_all").linkbutton({
			onClick : function() {
				$('#CustomerDgrid').datagrid({  
					pageNumber : 1,
					url : 'to_CustomerCareT'      
				});    
				$("#CustomerDgrid").datagrid("reload");
			}
		});  
		
		$("#llj_order_deleteMore").linkbutton({onClick:function(){
			var Rows=$("#CustomerDgrid").datagrid("getSelections");
			if(Rows.length==0){                          
				alert("请至少选择一行数据");  
				return false;
			} 
			if(Rows.length==0){                          
				alert("请至少选择一行数据");
				return false;   
			} 
			$.messager.confirm("确认","要删除所有所选记录?",function(isDelete){
				if(isDelete){    
					var strIds="";
					for(var i=0;i<Rows.length;i++){
    					strIds+=Rows[i].ccId+",";
    				}             
    				//循环切割   
    				strIds=strIds.substr(0,strIds.length-1);    
    				alert("输出："+strIds);        
    				$.getJSON("careDeleteMoreData",{strIds:strIds},function(obj){
   					 if(obj=='success'){                                               
   			    		 $.messager.alert("提示","删除成功！");
   			    	 }else{
       				     $.messager.alert("提示信息","删除失败！",'warning');
       				 }     
   					 $('#CustomerDgrid').datagrid('reload');          
   				 })   
				}
			})
		}}) ;
	})
     $(function(){
    	 $("#CustomerDgrid").datagrid({
				fit:true,border:false,
				toolbar:'#Customer_tb',pageSize:8,pageList:'[5,8,9,10,20]',fitColumns:true,url:'get_All_CustomerCare_page',method:'get',   
				pagination:true, columns:[[     
		        {field:'cc',width:1,checkbox:true},      
		        {field:'ccId',title:'主题编号',width:1}, 
		        {field:'ccTheme',title:'主题',width:2},
		        {field:'customerName',title:'用户名',width:1},
		        {field:'ccLinkMan',title:'联系人',width:1},
		        {field:'ccExecutor',title:'执行人',width:1,hidden:true},
		        {field:'ccFeedback',title:'客户反馈',width:2},    
		        {field:'ccCreationTime',title:'创建时间',width:2,
		        	 formatter:function(value,row,index){ 
				            if(value){ 
				            var date = new Date(value); 
				            var month = date.getMonth() + 1; 
				            var day = date.getDate(); 
				            if(month<10){ 
				            month='0'+month; 
				            } 
				            if(day<10){ 
				            day='0'+day;    
				            } 
				            return date.getFullYear() + '年' + month + '月'+ day+'日'; 
				            } 
				            }},
		        {field:'ccRemarks',title:'备注',width:3},      
		        {field:'bb',width:2,title:'操作', formatter:function(value, row, index){       
		                var btn = '<a class="llj-customer-edit" onclick="editOrder('+row.ccId+')" href="javascript:void(0)" class="easyui-linkbutton"></a>';
		                var btn2 = '<a class="llj-customer-delete" onclick="deleteOrder('+row.ccId+')" href="javascript:void(0)" class="easyui-linkbutton"></a>'; 
		                var btn3 = '<a class="llj-customer-details" onclick="DetailsOrder('+row.ccId+')" href="javascript:void(0)" class="easyui-linkbutton"></a>'; 
		                return btn+btn2+btn3;     
		            }  
		        }  
		    ]],  
		    onLoadSuccess:function(data){   
		        $('.llj-customer-edit').linkbutton({text:'编辑',plain:true,iconCls:'icon-edit'});  
		        $('.llj-customer-delete').linkbutton({text:'删除',plain:true,iconCls:'icon-zj-delete'}); 
		        $('.llj-customer-details').linkbutton({text:'视图',plain:true,iconCls:'icon-orderinfo'});
		        $('.llj-customer-cus').linkbutton({plain:true,iconCls:'icon-customer'});
		    }  
			});		
		});
     
</script>   
<style type="text/css">
.C_Care_vspace_llj {
	margin-top: 15px;
}
</style>
<title>客户关怀</title>

	<table id="CustomerDgrid" class="easyui-datagrid">
	</table>
	
	<div id="Customer_tb">
		<a><input
			class="easyui-searchbox"
			data-options="width:230,prompt:'关怀主题',  
			searcher:function(value,name){
				//修改datagrid的url
				$('#CustomerDgrid').datagrid({pageNumber:1, url: 'get_CustomerCare_page_byTheme'});
				//重新加载数据           
				$('#CustomerDgrid').datagrid('load', {key:value});              
			}"></a>      
			  
		<a id="CustormerAdd" href="javascript:void(0)" class="easyui-linkbutton"
			data-options="iconCls:'icon-add',plain:true">添加</a><a              
			id="llj_refresh_list_all" href="javascript:void(0)" class="easyui-linkbutton"
			data-options="iconCls:'icon-reload',plain:true">刷新</a>
		<a id="llj_order_deleteMore" href="javascript:void(0)" class="easyui-linkbutton"
			data-options="iconCls:'icon-cut',plain:true">批量删除</a>          
	</div>                
	
	<div id="CustormerAddLog" class="easyui-dialog" style="width: 585px; height: 530px; padding: 10px;"        
		    data-options="iconCls:'icon-add',resizable:true,modal:true,closed:true">
	<div class="easyui-layout" data-options="fit:true">          
		<div data-options="region:'center'" style="padding:10px;">
			<form method="post" id="C_Care_form_data">   
				<div id="C_Care_div_addGHZT" style="width: 480px">
					<div class="C_Care_same_div">
					    <input name="ccId" id="C_care_inputccId" type="text" style="display:none">     
						<input name="ccTheme" id="C_care_inputccTheme"  class="easyui-textbox"
							data-options="  
					    	label: '关怀主题:',  
					    	labelPosition: 'left',      
					    	labelWidth:82,
					    	validType:'ccTheme',
					    	required:true"
							style="width: 460px">  
					</div>  
					<br/>
					<div class="C_Care_div_customerName"><!--  -->
						<input name="customerName" id="C_care_inputName" class="easyui-textbox"
							data-options=" label: '客户:',labelPosition: 'left',labelWidth:60,required:true,
							editable:false,buttonText:'选择客户',required:true,             
							onClickButton:function(){
							getCustomer(function(row){ 
							   $('#C_care_inputName').textbox('setValue',row.custId);     
							   $('#C_care_inputName').textbox('setText',row.custCname);                  
							})                                     
							}" 
							style="width: 440px">   
					</div>   
					<br/> 
					<br/>
					<div class="C_Care_div_linkman">
						<input name="ccLinkMan" id="C_Care_input_linkman"
							class="easyui-textbox"
							data-options="panelHeight:'auto',label: '联系人:',width:150,labelWidth:70" />
	                        <a id="C_Care_ccLinkMan" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"></a>
						<div id="C_Care_div_dateInput"
							style="display: inline; margin-left: 90px">
							<input name="ccCreationTime" id="C_Care_dateInput" type="text"
								class="easyui-datebox"
								data-options="label:'日期:',labelPosition: 'left',labelWidth:55, width:180, 
								required:true,
								"></input>
						</div>
					</div>
					<br/>  
					<br/>
					<div class="C_Care_div_excute">
						<input name="ccExecutor" id="C_Care_input_excute"
							class="easyui-textbox"  
							data-options="panelHeight:'auto',label: '执行人:',width:150,labelWidth:70" />
							<a id="C_Care_ccLinkMan" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"></a>
						<div class="C_Care_div_style">    
							<input name="" id="C_Care_input_Type" class="easyui-combobox"
								data-options="panelHeight:'auto',label: '类型:',width:180,labelWidth:50,         
		     		        valueField:'careCategory',textField:'careContain',url:'find_Care_type_data',
		     		        required:true,editable:false" />
						</div>    
					</div>   
					<br/>
					<br/>
					<div>
						<div class="C_Care_div_ghnr_input">
							<input name="ccContent" id="C_Care_ghnr_input"
								class="easyui-textbox"
								data-options="width:220,label:'关怀内容:',labelWidth:82,multiline:true,requinone:true">
								
						</div>
						<br/>
						<br/> <input name="ccFeedback" id="C_Care_ghnr_input"
							class="easyui-textbox"
							data-options="width:220,label:'客户反馈:',labelWidth:82,multiline:true">  
					</div>
					<br/>  
					<br/>
					<div class="C_Care_div_remarks">
						<input name="ccRemarks" id="C_Care_bz_input" class="easyui-textbox"
							data-options="width:320,label:'备注:',labelWidth:58,multiline:true">   
					</div>
					<br/>
					<br/>    
				</div>
		</form>     
		</div>
		<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
			<a id="llj-add-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true">提交</a>
			<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0)" onclick="javascript:$('#CustormerAddLog').window('close');">关闭</a>
		</div>
	</div>	
   </div>    
</body>
</html>